package com.fsnbigdata.domain;

import io.springlets.format.EntityFormat;
import java.util.Objects;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Version;

import org.hibernate.validator.constraints.Length;
import org.springframework.roo.addon.javabean.annotations.RooEquals;
import org.springframework.roo.addon.javabean.annotations.RooJavaBean;
import org.springframework.roo.addon.javabean.annotations.RooToString;
import org.springframework.roo.addon.jpa.annotations.entity.RooJpaEntity;

/**
 * = AnimalConservationLocation
 *
 * TODO Auto-generated class documentation
 *
 */
@RooJavaBean
@RooToString
@RooJpaEntity(entityFormatExpression = "#{name}")
@RooEquals(isJpaEntity = true)
@Entity
@EntityFormat("#{name}")
public class AnimalConservationLocation {

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @Version
    private Integer version;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @EntityFormat
    private AnimalConservation animalConservation;

    /**
     * 保育地点
     */
    @Length(min = 0, max = 255,message = "preserveLocation长度必须0-255之间")
    private String preserveLocation;

    /**
     * 原始数量
     */
    @Length(min = 0, max = 255,message = "quantity长度必须0-255之间")
    private String quantity;

    /**
     * 保育方式
     */
    @Length(min = 0, max = 255,message = "conservationWay长度必须0-255之间")
    private String conservationWay;

    /**
     * 保育起始日期
     */
    @Length(min = 0, max = 255,message = "conservationStartDate长度必须0-255之间")
    private String conservationStartDate;

    /**
     * 保育结果
     */
    @Length(min = 0, max = 255,message = "conservationResult长度必须0-255之间")
    private String conservationResult;

    /**
     * 统计人
     */
    @Length(min = 0, max = 255,message = "recorder长度必须0-255之间")
    private String recorder;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    public static final String ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE = "The given Iterable of items to add can't be null!";

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    public static final String ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE = "The given Iterable of items to add can't be null!";

    /**
     * This `equals` implementation is specific for JPA entities and uses
     * the entity identifier for it, following the article in
     * https://vladmihalcea.com/2016/06/06/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
     *
     * @param obj
     * @return Boolean
     */
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        // instanceof is false if the instance is null
        if (!(obj instanceof AnimalConservationLocation)) {
            return false;
        }
        return getId() != null && Objects.equals(getId(), ((AnimalConservationLocation) obj).getId());
    }

    /**
     * This `hashCode` implementation is specific for JPA entities and uses a fixed `int` value to be able
     * to identify the entity in collections after a new id is assigned to the entity, following the article in
     * https://vladmihalcea.com/2016/06/06/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
     *
     * @return Integer
     */
    public int hashCode() {
        return 31;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Long
     */
    public Long getId() {
        return this.id;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Integer
     */
    public Integer getVersion() {
        return this.version;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param version
     */
    public void setVersion(Integer version) {
        this.version = version;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return AnimalConservation
     */
    public AnimalConservation getAnimalConservation() {
        return this.animalConservation;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param animalConservation
     */
    public void setAnimalConservation(AnimalConservation animalConservation) {
        this.animalConservation = animalConservation;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getPreserveLocation() {
        return this.preserveLocation;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param preserveLocation
     */
    public void setPreserveLocation(String preserveLocation) {
        this.preserveLocation = preserveLocation;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getQuantity() {
        return this.quantity;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param quantity
     */
    public void setQuantity(String quantity) {
        this.quantity = quantity;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getConservationWay() {
        return this.conservationWay;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param conservationWay
     */
    public void setConservationWay(String conservationWay) {
        this.conservationWay = conservationWay;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getConservationStartDate() {
        return this.conservationStartDate;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param conservationStartDate
     */
    public void setConservationStartDate(String conservationStartDate) {
        this.conservationStartDate = conservationStartDate;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getConservationResult() {
        return this.conservationResult;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param conservationResult
     */
    public void setConservationResult(String conservationResult) {
        this.conservationResult = conservationResult;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getRecorder() {
        return this.recorder;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param recorder
     */
    public void setRecorder(String recorder) {
        this.recorder = recorder;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String toString() {
        return "AnimalConservationLocation {" + "id='" + id + '\'' + ", version='" + version + '\'' + ", preserveLocation='" + preserveLocation + '\'' + ", quantity='" + quantity + '\'' + ", conservationWay='" + conservationWay + '\'' + ", conservationStartDate='" + conservationStartDate + '\'' + ", conservationResult='" + conservationResult + '\'' + ", recorder='" + recorder + '\'' + ", ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE='" + ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE + '\'' + ", ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE='" + ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE + '\'' + "}" + super.toString();
    }
}
